 <%@include file="/WEB-INF/common/taglibs.jsp"%>
<script type="text/javascript" src="${ctx}/resources/js/datatable-query.js"></script>
<div class="row-fluid">
		<div class="span12">
			<div class="box gradient">
				<div class="title">
					<h4><span>Members</span>
					</h4>
					<a href="#" class="minimize">Minimize</a>
				</div>
				<div class="content clearfix scrollable">
					<table class="ajaxTable display table table-bordered">
						<thead>
							<tr>
								<th><a id="select_all"><span class="icomoon-icon-checkmark-2"></span></a></th>
 							<th>SurName </th>
<th>GivenName </th>
<th>Company </th>
<th>Email </th>
<th>Telephone </th>
<th>Fax </th>
<th>NewsLetter </th>
<th>Status </th>
<th>Action </th>
							</tr>
						</thead>
					</table>
				</div>
			</div>
		</div>
<a href="${ctx}/admin/basic-member/create/" class="btn btn-info"> <span	class="icon12 icomoon-icon-plus white"></span> New</a>	
<a href="${ctx}/admin/basic-member/generate/" class="btn btn-info"> <span	class="icon12 icomoon-icon-plus white"></span> Generate</a>	</div>


<script type="text/javascript">

var render = false;
var oTime = "";
$(document).ready(function () {
	johnny.oTable = $('.ajaxTable').dataTable({
		"bLengthChange": true,
		"aoColumnDefs": [
		  { 'bSortable': false, 'aTargets': [0,7] }
		],
		"sAjaxSource": '${ctx}/admin/basic-member/',
		"fnInitComplete": function (oSettings, json) { }
	});
	
	var name = $("<input>").attr({
		type : "text",
		field : "surName",
		op : "cn",
		placeholder : "Title",
		class : "filterdata"
	});
	johnny.initTableQuery(name);

	var deleteFun = {
			id : 'disable',
			text  : 'Disable Member',
			domain : "Member",
			operation : "Disable",
			url : "${ctx}/admin/basic-member/disable/"
		};
		johnny.tableBtn(deleteFun);
		
		var approveBtn = {
				id : 'enable',
				text  : 'Approve /Enable',
				domain : "Member",
				operation : "approve",
				url : "${ctx}/admin/basic-member/enable/"
			};
		johnny.tableBtn(approveBtn);
		
		
		var delBtn = {
				id : 'del',
				text  : 'Del',
				domain : "Member",
				operation : "Del",
				url : "${ctx}/admin/basic-member/del/"
			};
		johnny.tableBtn(delBtn);
  
	 
});
function updateGrid() {
	window.clearTimeout(oTime);
	oTime = setTimeout(function () { oTable.fnDraw(); }, 500);
}

var columnHeader = ['','surName', 'givenName', 'company','email','telephone','fax','newsLetter','status'];
var QueryData = function (aoData) {
	return johnny.initQueryData(aoData, columnHeader);
}

var DataTableForm = function (json, echo) {
	var dataArray = new Array();
	for (var i = 0; i < json.result.length; i++) {
		var subArray = new Array();
		var value = johnny.getForSelect(json.result[i].id);
 		subArray.push(value);
 		subArray.push(json.result[i].surName)
 		subArray.push(json.result[i].givenName)
 		subArray.push(json.result[i].company)
 		subArray.push(json.result[i].email)
  		subArray.push(json.result[i].telephone)
 		subArray.push(json.result[i].fax)
 		subArray.push(json.result[i].newsLetter)
 		subArray.push(json.result[i].status)
 		var link ="${ctx}/admin/basic-member/"+json.result[i].id+"/edit/";
		subArray.push(johnny.getEditHtml(link));
		dataArray.push(subArray);
	}
	return {
		sEcho: echo,
		iTotalRecords: json.totalCount,
		iTotalDisplayRecords: json.totalCount,
		aaData: dataArray
	};
}
 
</script>
 
 
<body>


